#!/bin/sh
#
# http://maxwit.googlecode.com
#
# Authors:
#     Conke Hu    <conke.hu@gmail.com>
#     Tiger Yu    <tigerflying.yu@gmail.com>
#     Fleya Hou   <fleya.hou@gmail.com>
#

# TODO:
# check source package list

THIS_TOP=`dirname $0`

. ${THIS_TOP}/../core/bmw_base

UTILS_BUILD_PATH=${BUILD_PATH}/utils
mkdir -vp ${UTILS_BUILD_PATH}

UtilsBuildList()
{
	local pkg=""

	for pkg in $*
	do
		BuildPkg ${pkg} ${THIS_TOP} ${UTILS_BUILD_PATH} ${UTILS_PATH} || exit 1
	done
}


UTILS_PKG_LIST="\
	${MWP_PATCH} \
	${MWP_GETTEXT} \
	${MWP_ZLIB} \
	${MWP_M4} \
	${MWP_LIBTOOL} \
	${MWP_FLEX} \
	${MWP_BISON} \
	${MWP_SED} \
	${MWP_GAWK} \
	${MWP_TEXINFO} \
	${MWP_GMP} \
	${MWP_MPFR} \
	${MWP_AUTOCONF} \
	${MWP_AUTOMAKE} \
	${MWP_PERL} \
	${MWP_GREP} \
	${MWP_SBOX2} \
	${MWP_QEMU} \
	"

CheckPkg "${UTILS_PKG_LIST}"


mkdir -vp ${UTILS_PATH}/bin
mkdir -vp ${UTILS_PATH}/lib
mkdir -vp ${UTILS_PATH}/share/man/man1
echo


UtilsBuildList ${UTILS_PKG_LIST}

sed -i "s:\(.*my.*ENV.*\)libtoolize:\1${UTILS_PATH}/bin/libtoolize:" ${UTILS_PATH}/bin/autoreconf || exit 1

echo
echo Done!
echo
